﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharedGenomics.DataAccess
{
    public class GenotypeDataFileParserFactory
    {
        public virtual IGenotypeDataFileParser GetParserForFile(string filePath, GenotypeDataFileFormat format)
        {
            return this.GetParserForFile(filePath, format, null);
        }

        public virtual IGenotypeDataFileParser GetParserForFile(string filePath, GenotypeDataFileFormat format, IndividualSexLookup sexLookup)
        {
            IGenotypeDataFileParser parser = null;
            switch (format)
            {
                case GenotypeDataFileFormat.BCSnpMaxExport:
                    parser = new BCSnpMaxGenotypeFileParser(filePath);
                    break;

                case GenotypeDataFileFormat.BeadStudioExport:
                    parser = new BeadStudioGenotypeFileParser(filePath);
                    break;

                default:
                    throw new ArgumentException(String.Format("Invalid genotype file format: {0}", format));
            }

            parser.SexLookup = sexLookup;
            return parser;
        }
    }
}
